import * as tslib_1 from "tslib";
import { observable, action } from "mobx";
import request from "../utils/request";
import * as api from "../api/api";
import { LoadHoc, loading } from "../hoc/loadHoc";
let HomeStore = class HomeStore extends LoadHoc {
  constructor() {
    super(...arguments);
    /**
     * 首页数据
     */
    this.home = {};
    /**
    * 获取分页最新信息
    */
    this.allInfomations = {};
    /**
     * 获取信息详情
     */
    this.infomationInfos = {};
  }
  /**
   * 获取首页数据
   */
  async getHomeInfo(params) {
    const { callback } = params;
    const home = await request(api.ApphomeApiFetchParamCreactor.apphomeGetHomeInfoAsync({}));
    this.home = home;
    callback && callback(home);
  }
  /**
   * 保存发布信息
   */
  async saveUserInfomations(params) {
    const { form, callBack } = params;
    await request(api.ApphomeApiFetchParamCreactor.apphomeSaveUserInfomationsAsync({
      form
    }));
    callBack && callBack();
  }
  async getAllInfomations(params) {
    const { formPublicationType, pageIndex, pageSize, callback } = params;
    const allInfomations = await request(api.ApphomeApiFetchParamCreactor.apphomeGetAllInfomationsAsync({
      formPublicationType,
      formSkipCount: (pageIndex - 1) * pageSize,
      formMaxResultCount: pageSize
    }));
    this.allInfomations = allInfomations;
    callback && callback(allInfomations);
  }
  async getInfomationInfos(params) {
    const { formId, callback } = params;
    const infomationInfos = await request(api.ApphomeApiFetchParamCreactor.apphomeGetInfomationInfosAsync({
      formId
    }));
    this.infomationInfos = infomationInfos;
    callback && callback(infomationInfos);
  }
};
export { HomeStore as default };

tslib_1.__decorate([observable], HomeStore.prototype, "home", undefined);
tslib_1.__decorate([loading, action], HomeStore.prototype, "getHomeInfo", null);
tslib_1.__decorate([loading, action], HomeStore.prototype, "saveUserInfomations", null);
tslib_1.__decorate([observable], HomeStore.prototype, "allInfomations", undefined);
tslib_1.__decorate([loading, action], HomeStore.prototype, "getAllInfomations", null);
tslib_1.__decorate([observable], HomeStore.prototype, "infomationInfos", undefined);
tslib_1.__decorate([loading, action], HomeStore.prototype, "getInfomationInfos", null);